/*
 * Copyright 2008 Zoundry LLC, Inc.  All Rights Reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package org.zoundry.gaedt.ui.builders;

import org.eclipse.core.resources.IResource;
import org.zoundry.gaedt.core.ZGaeException;


/**
 * All build providers implement this interface.  A build provider is the
 * object that accepts an {@link IResource} and performs some sort of build
 * step on it.
 * 
 * Note that build providers must be stateless - only one instance of each
 * build provider will be created, and re-used for multiple resources.
 */
public interface IZGaeBuildProvider
{
    /**
     * Returns true if this provider can accept the given {@link IResource}
     * as input.  Essentially, returns true if this provider can build the
     * given {@link IResource}.
     * 
     * @param aResource
     */
    public boolean accept(IResource aResource);
    
    /**
     * Called when a resource is added or is changed and must be built.  Also
     * called when a full rebuild is requested.
     * 
     * @param aResource
     */
    public void build(IResource aResource) throws ZGaeException;
    
    /**
     * Called when a resource is removed from the workspace.
     * 
     * @param aResource
     */
    public void removeBuild(IResource aResource) throws ZGaeException;
}
